package com.un10.controller;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.un10.entity.Activitylist;
import com.un10.service.ActivitylistService;
import com.un10.util.Result;


@Controller
public class ActivitylistController {

	@Autowired
	ActivitylistService ActivitylistService;

	@RequestMapping("/houtai/getAllActivitylist")
	@ResponseBody
	public Object getPropicinfo(@RequestParam("page") int page, @RequestParam("limit") int limit,
			@RequestParam("venueName") String venueName) {

		List<Activitylist> user = ActivitylistService.findAllActivitylist((page - 1) * limit, limit, venueName);

		if (venueName == null || venueName == "") {
			venueName = null;
		}
		int count = ActivitylistService.getCount();
		System.out.println(venueName);
		com.un10.util.Result res = new com.un10.util.Result(0, "", count, user);
		return res;
	}

	@RequestMapping("/houtai/activitylistadd")
	@ResponseBody
	public Object activitylistadd(@RequestParam Map<String, Object> map) {

		System.out.println(map.get("venueName"));
		int i = ActivitylistService.findActivitylistAdd(map);
		Result res = new Result(0, "", i, true);
		return res;
	}

	@RequestMapping("/houtai/ActivitylistUpdate")
	@ResponseBody
	public Object updateActivitylist(@RequestParam Map<String, Object> map) {

		int i = ActivitylistService.findActivitylistUpdate(map);
		Result res = new Result(0, "", i, true);
		return res;
	}

	@RequestMapping("/houtai/activitylistdelete")
	@ResponseBody
	public Object activitylistdelete(@RequestParam("fieldID") Integer fieldID) {
		int i = ActivitylistService.findActivitylistDelete(fieldID);
		Result res = new Result(0, "", i, true);
		return res;
	}
}
